package com.zyf.scheduled;

import com.zyf.constant.MqConst;
import com.zyf.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/** 定时任务
 * @author zyf
 * @date 2021年06月04日 16:20
 */
@Component
@EnableScheduling  //开启定时任务注解
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    //每天8点执行方法，就医提醒
    //cron表达书。设置执行时间间隔
    //0 0 8 * * ?
    @Scheduled(cron = "0 0 8 * * ?")
    public void taskPatient(){
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"");
    }
}
